const axios = require('axios');

async function testAwait() {
    return new Promise((resolve) => {
        let today = new Date();
        axios.get("http://api.juheapi.com/japi/toh", { params: { "v": "1.0", "month": (today.getMonth() + 1), "day": today.getDate(), "key": "e5c414338334f59c36a1235ded65d791" } }).then(function (res) {
            console.log(res.data)
            resolve(res);
        }).catch(function (err) {
            console.log('err')
            if (err) throw err;
        });
    });
}

function testAwait1() {
    return new Promise((resolve) => {
        setTimeout(function () {
            console.log("testAwait1");
            resolve();
        }, 2000);
    });
}

async function helloAsync() {
    await testAwait().then(function (res) {
        console.log('testAwait --' + res);
    });
    console.log("helloAsync");
}

async function helloAsync1() {
    await testAwait1();

    console.log("helloAsync1");
}

async function ppp() {
    await Promise.all([helloAsync(), helloAsync1()]).then(function (post) {
        console.log("Promise.all")
    });

    console.log("Promise.all last line")
}

ppp();
